package com.example.demo.domain.entity;

import com.example.demo.domain.entity.Language;
import com.example.demo.domain.entity.JudgeResult;

import java.io.Serializable;
import java.util.Date;

/**
 * @author Capital Letters
 * @title: TrainingSubmission
 * @projectName oj-homework
 * @description: 训练系统提交实体
 * @date 2022/5/2416:47
 */
public class TrainingSubmission implements Serializable {

    /**
     * 唯一的序列化标识符.
     */
    private static final long serialVersionUID = -1984683070957842963L;


    /**
     * 评测记录的唯一标识符.
     */
    private long submissionId;

    /**
     * 评测对应的试题对象.
     */
    private TrainingProblem trainingProblem;

    /**
     * 提交所使用的语言对象.
     */
    private Language language;

    /**
     * 评测提交时间.
     */
    private Date submitTime;

    /**
     * 评测开始执行时间.
     */
    private Date executeTime;

    /**
     * 评测运行总时间.
     */
    private long usedTime;

    /**
     * 评测运行占用最大内存.
     */
    private int usedMemory;

    /**
     * 评测结果.
     */
    private JudgeResult judgeResult;

    /**
     * 评测运行得分.
     */
    private int judgeScore;

    /**
     * 评测运行日志.
     */
    private String judgeLog;

    /**
     * 评测所执行的代码.
     */
    private String code;

    /**
     * 评测记录类的默认构造函数.
     */
    public TrainingSubmission() { }

    /**
     * 评测记录类的构造函数.
     * @param trainingProblem - 评测对应的试题对象
     * @param language - 提交所使用的语言对象
     * @param code - 评测所执行的代码
     */
    public TrainingSubmission(TrainingProblem trainingProblem, Language language, String code) {
        this.trainingProblem = trainingProblem;
        this.language = language;
        this.code = code;
    }

    public static long getSerialVersionUID() {
        return serialVersionUID;
    }

    public long getSubmissionId() {
        return submissionId;
    }

    public void setSubmissionId(long submissionId) {
        this.submissionId = submissionId;
    }

    public TrainingProblem getTrainingProblem() {
        return trainingProblem;
    }

    public void setTrainingProblem(TrainingProblem trainingProblem) {
        this.trainingProblem = trainingProblem;
    }

    public Language getLanguage() {
        return language;
    }

    public void setLanguage(Language language) {
        this.language = language;
    }

    public Date getSubmitTime() {
        return submitTime;
    }

    public void setSubmitTime(Date submitTime) {
        this.submitTime = submitTime;
    }

    public Date getExecuteTime() {
        return executeTime;
    }

    public void setExecuteTime(Date executeTime) {
        this.executeTime = executeTime;
    }

    public long getUsedTime() {
        return usedTime;
    }

    public void setUsedTime(long usedTime) {
        this.usedTime = usedTime;
    }

    public int getUsedMemory() {
        return usedMemory;
    }

    public void setUsedMemory(int usedMemory) {
        this.usedMemory = usedMemory;
    }

    public JudgeResult getJudgeResult() {
        return judgeResult;
    }

    public void setJudgeResult(JudgeResult judgeResult) {
        this.judgeResult = judgeResult;
    }

    public int getJudgeScore() {
        return judgeScore;
    }

    public void setJudgeScore(int judgeScore) {
        this.judgeScore = judgeScore;
    }

    public String getJudgeLog() {
        return judgeLog;
    }

    public void setJudgeLog(String judgeLog) {
        this.judgeLog = judgeLog;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    @Override
    public String toString() {
        final StringBuffer sb = new StringBuffer("TrainingSubmission{");
        sb.append("submissionId=").append(submissionId);
        sb.append(", trainingProblem=").append(trainingProblem);
        sb.append(", language=").append(language);
        sb.append(", submitTime=").append(submitTime);
        sb.append(", executeTime=").append(executeTime);
        sb.append(", usedTime=").append(usedTime);
        sb.append(", usedMemory=").append(usedMemory);
        sb.append(", judgeResult=").append(judgeResult);
        sb.append(", judgeScore=").append(judgeScore);
        sb.append(", judgeLog='").append(judgeLog).append('\'');
        sb.append(", code='").append(code).append('\'');
        sb.append('}');
        return sb.toString();
    }
}
